home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d13 / qptech.arc / TI372.ASC < prev    next >
Text File  |  1991-04-25  |  3KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8. PRODUCT  :  QUATTRO PRO                            NUMBER  :  372
  9. VERSION  :  ALL
  10.      OS  :  DOS
  11.    DATE  :  April 18, 1991                 PAGE  :  1/2
  12.  
  13.   TITLE  :  INCREMENTING DATES BY MONTH
  14.  
  15.  
  16.  
  17.  
  18. To enter dates that calculate for the varying number of days in a
  19. month taking into consideration leap years, you need to use the
  20. following procedure:
  21.  
  22.    1.  In the first cell, enter the beginning date using Ctrl-D.
  23.        Format the cell to display the date as you desire using
  24.        /Style | Numeric Format | Date.    If the cell display
  25.        changes to *'s, you will need to widen the column using
  26.        /Style | Column Width.  For this example, cell A1 is used
  27.        as the first cell.
  28.  
  29.    2.  In the cell directly below the first cell (eg.  A2), enter
  30.        the following formula:
  31.  
  32.        +A1+@CHOOSE(@MONTH(A1)-1,31,@IF(@MOD(@YEAR(A1),4)=0
  33.        #AND#@MOD(@YEAR(A1),100)<>0#OR#@MOD(@YEAR(A1),400)=0,29,28)
  34.        ,31,30,31,30,31,31,30,31,30,31)
  35.  
  36.        This formula should be entered in its entirety in the
  37.        second cell (eg.  A2).  Do not split the formula.
  38.  
  39.    3.  Copy this formula to the rest of the cells in the column
  40.        using /Edit | Copy.
  41.  
  42.    4.  Format the cells to the display format you want using
  43.        /Style | Numeric Format | Date.
  44.  
  45. This example details how to enter the dates in a column.  The
  46. same formula would work across the row as well.
  47.  
  48. This procedure will work for any day of the month between 1 and
  49. 28.  You will need to edit some of the formulas if you need to
  50. use days between 29 and 31.
  51.  
  52. The logic behind this formula is as follows:
  53.  
  54. +A1+@CHOOSE(@MONTH(A1)-1,31,
  55.     ... ,31,30,31,30,31,31,30,31,30,31)
  56.  
  57.     calculates the month of the previous entry (eg. A1) and
  58.     adds the number of days in the current month to the
  59.     previous entry.  The @CHOOSE command calculates the
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. PRODUCT  :  QUATTRO PRO                            NUMBER  :  372
  75. VERSION  :  ALL
  76.      OS  :  DOS
  77.    DATE  :  April 18, 1991                 PAGE  :  2/2
  78.  
  79.   TITLE  :  INCREMENTING DATES BY MONTH
  80.  
  81.  
  82.  
  83.  
  84.     number of days to add from the list based on the results
  85.     of the @IF function.
  86.  
  87. @IF(@MOD(@YEAR(A1),4)=0 #AND# @MOD(@YEAR(A1),100)<>0
  88.     #OR# @MOD(@YEAR(A1),400)=0,29,28)
  89.  
  90.     determines whether the year is a leap year by testing for
  91.     the following three conditions:
  92.  
  93.        1.  All leap years are evenly divisible by 4.
  94.  
  95.        2.  All years divisible by 100 are not necessarily
  96.            leap years.
  97.  
  98.        3.  All years evenly divisible by 400 are leap years.
  99.  
  100. If the year is a leap year, the formula adds 29 days to the month
  101. of February.  If not, it adds only 28.
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.